package com.qianyue.命令模式;

import java.util.ArrayList;
import java.util.List;

/**
 * 侍者
 *
 * @author qian yue
 * @version v1.0.0
 * @since 2025/2/4 21:58
 */
public class Waitor {
    private final List<Command> commands = new ArrayList<Command>();

    public void addCommand(Command command) {
        commands.add(command);
    }

    public void orderUp() {
        for (Command command : commands) {
            if (command != null) {
                command.execute();
            }
        }
    }
}
